<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('岗位审核列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>申请人ID：</label>
                                <input type="text" name="publishUserId"/>
                            </li>
                            <li>
                                <label>检查人ID：</label>
                                <input type="text" name="exmineUserId"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('wstudy:examine:edit')}]];
        var removeFlag = [[${@permission.hasPermi('wstudy:examine:remove')}]];
        var statusDatas = [[${@dict.getType('wst_post_status')}]];
        var prefix = ctx + "wstudy/examine";
        var prefixPost = ctx + "wstudy/post";
        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "岗位审核",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'post.postId',
                    title: 'ID',
                    visible: false
                },
                {
                    field: 'post.postCode',
                    title: '岗位编码'
                },
                {
                    field: 'post.postName',
                    title: '岗位名称'
                },
                {
                    field: 'post.needNum',
                    title: '招聘人数'
                },
                {
                    field: 'post.salary',
                    title: '工资'
                },
                {
                    field: 'post.status',
                    title: '状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                {
                    field: 'post.workplace',
                    title: '工作地址'
                },
                {
                    field: 'post.startTime',
                    title: '招聘开始时间'
                },
                {
                    field: 'post.endTime',
                    title: '招聘结束时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        let approvalFlag = "APPROVAL_FAILED" ==row.post.status;
                        let actions = [];
                        actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="details(\'' + row.post.postId + '\')"><i class="fa fa-search"></i>详情</a> ');
                        if (!approvalFlag){
                            actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="examine(\'' + row.post.postId + '\')"><i class="fa fa-edit"></i>审核</a> ');
                        }
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        function details(id) {
            $.modal.openTab("详情",prefixPost+"/details/"+id)
        }
        function examine(postId) {
            parent.layer.open({
                type: 2,
                area: ['1080px','600px'],
                fix: true,
                maxmin: true,
                shade: 0.3,
                shadeClose:true,
                title: '审核',
                content: prefixPost+"/examinePage/"+postId,
                btn: ['同意','不同意','取消']
                ,success:function (layero, index){    //弹出层加载成功后执行
                    let iframeWin = parent.window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：
                }
                ,yes: function(index, layero){
                    let iframeWin = parent.window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：
                    iframeWin.submitHandlerAgree();
                }
                ,btn2: function(index, layero){
                    let iframeWin = parent.window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：
                    iframeWin.submitHandlerDisAgree();
                }
                ,cancel: function(){

                }
                ,end:function () {
                    $.table.refresh()
                }
            });
        }
    </script>
</body>
</html>